home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 5 / QRZ Ham Radio Callsign Database - Volume 5.iso / files / mac / dx_map.hqx / DX Map / DX Map 1.1 / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1991-10-11  |  13.5 KB  |  23 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in.1</name>
  5.     <id>-1</id>
  6.     <cardCount>4</cardCount>
  7.     <cardID>5555</cardID>
  8.     <listID>3742</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>200</height>
  15.     </cardSize>
  16.     <script>--ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö stack "DX Map 1.1" 10/6/91 10:26 PM
  17. --
  18. -- HANDLERS: openstack(globals:itime,lastact,updateInterval,
  19. -- delayInterval,GrayLineFlag,mylat,mylon,tz),closestack
  20. -- (globals:GrayLineflag),fixfonts,DoGrayLineTask(globals:nextTask,
  21. -- itime,lastupd,tz,thepoints),DoGrayLineTask123(globals:nextTask,
  22. -- itime,lastupd,tz,thepoints),DoGrayLineTask23(globals:nextTask,
  23. -- itime,lastupd,tz,thepoints),DoGrayLineNow(globals:nextTask,
  24. -- lastact),trackit,domenu(globals:needfix,lastact),resumestack
  25. -- (globals:lastact),opencard(globals:lastact),DoSunPos
  26. -- (globals:tz),UpdateLocation(globals:mylat,mylon,tz),
  27. -- PutMyPos(globals:lastact,tz,mylat,mylon),UpdateTime(globals:tz)
  28.  
  29. -- --
  30. -- FUNCTIONS: semitocom,semitocomns,daylightsavings,timecvt(globals:t24)
  31.  
  32. -- --
  33. --ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇô
  34. on openstack
  35. global itime,lastact, updateInterval, delayInterval, GrayLineFlag,┬¼
  36. mylat,mylon,tz
  37. -- The globals below can be changed to configure the general
  38. -- actions of this stack.
  39. --
  40. -- timing:
  41. -- Updating and plotting the grayline takes about 25 seconds on
  42. -- a Mac Plus, about 5 seconds on a Mac IIcx, and about 2 seconds
  43. -- on a IIfx. If you have a Plus (like I do) you don't want to be
  44. -- locked out for a period of 25 seconds. So there are 3 timing
  45. -- devices to minimize the interruption. The global, delayInterval,
  46. -- is a grace period (in ticks) that you have whenever you do anything,
  47. -- like press one of the buttons. This prevents an interruption when
  48. -- you are busy doing something in the stack. The global,
  49. -- updateInterval, is the minimum time (in ticks) for the grayline
  50. -- to update. The time chosen below is based on the fact that the
  51. -- grayline moves 1 pixel to the left about every 4 minutes. The
  52. -- calculation of the grayline can be broken up into 3 operations,
  53. -- and the stack tries to do these so that they are equally spaced
  54. -- during the updateInterval.
  55.  
  56. put 14400 into updateInterval  -- update grayline every 4 minutes
  57. put 1200 into delayInterval  -- 20 second wait after any action
  58.  
  59. go first cd
  60. UpdateLocation
  61. if the highlight of cd btn "sun" is "true" then
  62. put "false" into Graylineflag
  63. else
  64. put "true" into GrayLineflag
  65. end if
  66. updatetime
  67. DoSunPos
  68. if (( highlight of btn "Draw grayline on open" of cd "config") is "true") then
  69. dograylinenow
  70. end if
  71. put the ticks into itime
  72. put the ticks into lastact
  73. put 1 into nextTask
  74. pass openstack
  75. end openstack
  76.  
  77. on closestack
  78. global GrayLineflag
  79. if GrayLineflag is "true" then
  80. set the lockmessages to true
  81. set cursor to "watch"
  82. lock screen
  83. set the lockmessages to true
  84. set the lockRecent to true
  85. go cd "c2"
  86. choose select tool
  87. domenu "Select All"
  88. domenu "Copy Picture"
  89. go cd "c1"
  90. domenu "Paste Picture"
  91. choose browse tool
  92. unlock screen
  93. set the lockmessages to false
  94. set the lockRecent to false
  95. end if
  96. pass closestack
  97. end closestack
  98.  
  99. on fixfonts
  100. set textfont of cd fld "country list" to "MonaHam"
  101. set textfont of cd fld "f1" to "MonaHam"
  102. set textfont of cd fld "utctime" to "MonaHam"
  103. set textfont of cd fld "localtime" to "MonaHam"
  104. set textfont of cd fld "otime" to "MonaHam"
  105. set textfont of cd fld "list" to "MonaHam"
  106. set textfont of cd fld "find call" to "MonaHam"
  107. end fixfonts
  108.  
  109. on DoGrayLineTask
  110. global nextTask,itime, lastupd,tz, thepoints
  111. put the ticks into ttt
  112. put the ticks into itime
  113. if nextTask is 1 then  -- calculate the points
  114. set cursor to "watch"
  115. if daylightsavings() is "false" then -- dls
  116. get SunPos(tz)
  117. else
  118. get SunPos(tz+1)
  119. end if
  120. put GrayPos(item 1 of it, item 2 of it) into thepoints
  121. end if
  122. if nextTask is 2 then  -- draw the line
  123. set cursor to "watch"
  124. lock screen
  125. put thepoints into fff
  126. go cd "c3"
  127. choose line tool
  128. put number of items in fff into n2
  129. repeat with i=1 to (n2/2 - 1)
  130. drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))┬¼
  131. to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
  132. end repeat
  133. choose browse tool
  134. go cd "c1"
  135. unlock screen
  136. end if
  137. if nextTask is 3 then -- get fresh map and paste night region
  138. set cursor to "watch"
  139. lock screen
  140. go cd "c2"
  141. choose select tool
  142. domenu "Select All"
  143. domenu "Copy Picture"
  144. go cd "c1"
  145. domenu "Paste Picture"
  146. go cd "c3"
  147. drag from 152,0 to 512,200 with optionkey
  148. domenu "Cut Picture"
  149. go cd "c1"
  150. domenu "Paste Picture"
  151. domenu "pickup"
  152. domenu "invert"
  153. choose browse tool
  154. put the ticks into lastupd
  155. unlock screen
  156. end if
  157. if nextTask <> 3 then
  158. add 1 to nextTask
  159. else
  160. put 1 into nextTask
  161. end if
  162. end DoGrayLineTask
  163.  
  164.  
  165. on DoGrayLineTask123
  166. global nextTask,itime, lastupd,tz, thepoints
  167. put the ticks into xxxx
  168. set the lockMessages to true
  169. set the lockRecent to true
  170. set cursor to "watch"
  171. lock screen
  172. if daylightsavings() is "false" then -- dls
  173. get SunPos(tz)
  174. else
  175. get SunPos(tz+1)
  176. end if
  177. put GrayPos(item 1 of it, item 2 of it) into thepoints
  178. put thepoints into fff
  179. go cd "c3"
  180. choose line tool
  181. put number of items in fff into n2
  182. repeat with i=1 to (n2/2 - 1)
  183. drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))┬¼
  184. to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
  185. end repeat
  186. go cd "c2"
  187. choose select tool
  188. domenu "Select All"
  189. domenu "Copy Picture"
  190. go cd "c1"
  191. domenu "Paste Picture"
  192. go cd "c3"
  193. drag from 152,0 to 512,200 with optionkey
  194. domenu "Cut Picture"
  195. go cd "c1"
  196. domenu "Paste Picture"
  197. domenu "pickup"
  198. domenu "invert"
  199. choose browse tool
  200. put the ticks into lastupd
  201. put the ticks into itime
  202. put 1 into nextTask
  203. unlock screen
  204. set the lockMessages to false
  205. set the lockRecent to false
  206. --put (the ticks - xxxx) / 60
  207. end DoGrayLineTask123
  208.  
  209. on DoGrayLineTask23
  210. global nextTask,itime, lastupd,tz,thepoints
  211. set cursor to "watch"
  212. lock screen
  213. put thepoints into fff
  214. go cd "c3"
  215. choose line tool
  216. put number of items in fff into n2
  217. repeat with i=1 to (n2/2 - 1)
  218. drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))┬¼
  219. to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
  220. end repeat
  221. go cd "c2"
  222. choose select tool
  223. domenu "Select All"
  224. domenu "Copy Picture"
  225. go cd "c1"
  226. domenu "Paste Picture"
  227. go cd "c3"
  228. drag from 152,0 to 512,200 with optionkey
  229. domenu "Cut Picture"
  230. go cd "c1"
  231. domenu "Paste Picture"
  232. domenu "pickup"
  233. domenu "invert"
  234. choose browse tool
  235. put the ticks into lastupd
  236. put the ticks into itime
  237. put 1 into nextTask
  238. unlock screen
  239. end DoGrayLineTask23
  240.  
  241.  
  242. on DoGrayLineNow
  243. global nextTask, lastact
  244. put the ticks into lastact
  245. if nexttask = 1 then
  246. DoGrayLineTask123
  247. else if nexttask = 2 then
  248. DoGrayLineTask23
  249. else
  250. DoGrayLineTask
  251. end if
  252. end DoGrayLineNow
  253.  
  254. on trackit
  255. if the mouseloc is within the rect of cd btn "mapbtn" then ┬¼
  256. set the loc of the target to the mouseloc
  257. put round(90 - (0.89109 * (item 2 of the loc of the target))) into lat
  258. put round((item 1 of the loc of the target - 153) * 1.0056 - 180) into lon
  259. put abs(lat) into stuff
  260. if lat > 0 then
  261. put "┬░ North" & return after stuff
  262. else
  263. put "┬░ South" & return after stuff
  264. end if
  265. put abs(lon) after stuff
  266. if lon > 0 then
  267. put "┬░ East" after stuff
  268. else
  269. put "┬░ West" after stuff
  270. end if
  271. put stuff into cd fld "f1"
  272. end trackit
  273.  
  274. on domenu thing
  275. global needfix, lastact
  276. if thing is "Compact Stack" then
  277. put "yes" into needfix
  278. end if
  279. put the ticks into lastact
  280. pass domenu
  281. end domenu
  282.  
  283. on resumestack
  284. global lastact
  285. put the ticks into lastact
  286. pass resumestack
  287. end resumestack
  288.  
  289. on opencard
  290. global lastact
  291. put the ticks into lastact
  292. pass opencard
  293. end opencard
  294.  
  295. function semitocom craig
  296. repeat until (offset(";", craig) = 0)
  297. put offset(";", craig) into sco
  298. put "," into char sco of craig
  299. put " " after char sco of craig
  300. end repeat
  301. return craig
  302. end semitocom
  303.  
  304. function semitocomns craig
  305. repeat until (offset(";", craig) = 0)
  306. put offset(";", craig) into sco
  307. put "," into char sco of craig
  308. end repeat
  309. return craig
  310. end semitocomns
  311.  
  312. on DoSunPos
  313. global tz
  314. if daylightsavings() is "false" then -- dls
  315. put SunPos(tz) into tsp
  316. else
  317. put SunPos(tz+1) into tsp
  318. end if
  319. put round((item 2 of tsp + 180) * (511 - 153) / 360 + 153)  & "," into pos
  320. put round((90- item 1 of tsp) * (202-0) / 180 + 0) after pos
  321. set the location of btn "sun" to pos
  322. end DoSunPos
  323.  
  324. function daylightsavings
  325. if the highlight of btn "auto daylight savings" of cd "config" ┬¼
  326. is "false" then
  327. if the highlight of btn "summer time" of cd "config" is "true" then
  328. put "true" into daylightsavings
  329. else
  330. put "false" into daylightsavings
  331. end if
  332. else
  333. put the time into mytime
  334. convert mytime to dateitems
  335. if (item 2 of mytime < 4) or (item 2 of mytime >10) then
  336. put "false" into daylightsavings
  337. else if (item 2 of mytime > 4) and (item 2 of mytime <10) then
  338. put "true" into daylightsavings
  339. else if (item 2 of mytime is 4) then -- April
  340. if item 3 of tt > 7 then
  341. put "false" into daylightsavings
  342. else
  343. --find the witching hour
  344. put mytime into cutover
  345. convert cutover to dateitems
  346. repeat with i = 1 to 7
  347. put i into item 3 of cutover
  348. convert cutover to long date
  349. convert cutover to dateitems
  350. if item 7 of cutover is 1 then exit repeat
  351. end repeat
  352. put 2 into item 4 of cutover -- 2 am is the time
  353. convert cutover to seconds
  354. convert mytime to seconds
  355. if mytime >= cutover then
  356. put "true" into daylightsavings
  357. else
  358. put "false" into daylightsavings
  359. end if
  360. end if
  361. else -- October
  362. if item 3 of mytime < 24 then
  363. put "true" into daylightsavings
  364. else
  365. --find the witching hour
  366. put mytime into cutover
  367. convert cutover to dateitems
  368. repeat with i = 24 to 31
  369. put i into item 3 of cutover
  370. convert cutover to long date
  371. convert cutover to dateitems
  372. if item 7 of cutover is 1 then exit repeat
  373. end repeat
  374. put 2 into item 4 of cutover -- 2 am is the time
  375. convert cutover to seconds
  376. convert mytime to seconds
  377. if mytime >= cutover then
  378. put "false" into daylightsavings
  379. else
  380. put "true" into daylightsavings
  381. end if
  382. end if
  383. end if
  384. end if
  385. return daylightsavings
  386. end daylightsavings
  387.  
  388. on UpdateLocation
  389. global mylat,mylon,tz
  390. if the highlight of btn "Location" of cd "config" is true then
  391. GetLocale
  392. put the result into locres
  393. if word 1 of locres is "Error" then
  394. Beep
  395. answer "Error getting your location from parameter RAM. Go to the next card and set it manually." with "OK"
  396. else
  397. put item 1 of locres into mylat
  398. put item 2 of locres into mylon
  399. end if
  400. else
  401. put cd fld "lat" of cd "config" into tlat
  402. if (tlat is a number) and (tlat>=0) and (tlat<=90) then
  403. if the highlight of btn "N" of cd "config" is true then
  404. put tlat into mylat
  405. else
  406. put -tlat into mylat
  407. end if
  408. else
  409. Beep
  410. answer "Invalid latitude" with "OK"
  411. go cd "config"
  412. exit updatelocation
  413. end if
  414. put cd fld "lon" of cd "config" into tlon
  415. if (tlon is a number) and (tlon>=0) and (tlon<=180) then
  416. if the highlight of btn "E" of cd "config" is true then
  417. put tlon into mylon
  418. else
  419. put -tlon into mylon
  420. end if
  421. else
  422. Beep
  423. answer "Invalid latitude" with "OK"
  424. go cd "config"
  425. exit updatelocation
  426. end if
  427. end if
  428. if the highlight of btn "Time Zone" of cd "config" is true then
  429. GetLocale
  430. put the result into locres
  431. if word 1 of locres is "Error" then
  432. Beep
  433. answer "Error getting your time zone from parameter RAM" with "OK"
  434. else
  435. put item 3 of locres into tz
  436. end if
  437. else
  438. put cd fld "tz" of cd "config" into ttz
  439. if (ttz is a number) and (ttz>=-24) and (ttz<=24) then
  440. put ttz into tz
  441. else
  442. Beep
  443. answer "Invalid time difference" with "OK"
  444. go cd "config"
  445. exit updatelocation
  446. end if
  447. end if
  448. PutMyPos
  449. DoSunPos
  450. end UpdateLocation
  451.  
  452. on PutMyPos
  453. global lastact,tz,mylat,mylon
  454. put round((mylon + 180) * (511 - 153) / 360 + 153)  & "," into pos
  455. put round((90-mylat) * (202-0) / 180 + 0) after pos
  456. set the location of btn "here" to pos
  457. if (item 1 of pos) > 483 then put 483 into item 1 of pos
  458. if (item 1 of pos) < 181 then put 181 into item 1 of pos
  459. put 5 into item 2 of pos
  460. set the loc of cd fld "localtime" to pos
  461. if tz is not empty then
  462. show cd fld "utctime"
  463. if cd fld "otz" is not empty then
  464. show cd fld "otime"
  465. end if
  466. updatetime
  467. else
  468. hide cd fld "otime"
  469. hide cd fld "utctime"
  470. end if
  471. put the ticks into lastact
  472. end PutMyPos
  473.  
  474. On UpdateTime
  475. global tz
  476. put timecvt(the time) into cd fld "Localtime"
  477. if tz is not empty then
  478. put the time into ttemp
  479. convert ttemp to dateItems
  480. convert ttemp to seconds
  481. add -tz * 3600 to ttemp
  482. if daylightsavings() is "true" then subtract 3600 from ttemp -- dls
  483. convert ttemp to dateItems
  484. put item 4 of ttemp into hr
  485. put item 5 of ttemp into mn
  486. if length of hr = 1 then put "0" & hr into hr
  487. if length of mn = 1 then put "0" & mn into mn
  488. put hr & mn && "UTC" into cd field UTCtime
  489. if cd fld "otz" is not empty then
  490. put the time into ttemp
  491. convert ttemp to seconds
  492. add -((cd fld "otz") + tz) * 3600 to ttemp -- assumes summer time
  493. if daylightsavings() is "true" then subtract 3600 from ttemp -- dls
  494. convert ttemp to short time
  495. put timecvt(ttemp) into cd fld "otime"
  496. end if
  497. end if
  498. end UpdateTime
  499.  
  500. function timecvt mytime
  501. global t24
  502. if t24 is "true" then
  503. put offset(":",mytime) into colonpos
  504. put char 1 to (colonpos-1) of mytime into hr
  505. put char (colonpos+1) to (colonpos+2) of mytime into min
  506. put empty into prefix
  507. if hr is "12" then
  508. if word 2 of mytime is "AM" then
  509. put "0" into hr
  510. else
  511. put 12 into hr
  512. end if
  513. else
  514. if word 2 of mytime is "PM" then add 12 to hr
  515. end if
  516. if hr < 10 then put "0" after prefix
  517. return prefix & hr & min
  518. else
  519. return mytime
  520. end if
  521. end timecvt
  522.  
  523. </script>
  524.     <background id="2672" file="background_2672.xml" name="" />
  525.     <card id="5555" file="card_5555.xml" marked="false" name="c1" owner="2672" />
  526.     <card id="3866" file="card_3866.xml" marked="false" name="config" owner="2672" />
  527.     <card id="2241" file="card_2241.xml" marked="false" name="c2" owner="2672" />
  528.     <card id="3023" file="card_3023.xml" marked="false" name="c3" owner="2672" />
  529. </stack>
  530.